struct list
{
	int n;
	list *next;
};
list *root=NULL;
void adg_coada(int n)
{
 list*  el=(list *)malloc(sizeof(list));
   el->n=n;
   el->next=NULL;
	if(root==NULL)
	{
			root=el;
			return;
	}
	list *p=root;
	while(p->next)
		p=p->next;
	p->next=el;
}
int extrag_coada()
{
	if(!root)
		return -1;
	list *p=root;
	root=p->next;
	return p->n;
}
int verif_conex(int n,HWND hwnd)
{
	if(nrm<5)
		return 0;
	int verif[6]={0},t=0;
	if(n>5)
	{
		 MessageBox(hwnd, "Nu s-a introdus in mod corect graful!", "Eroare",MB_OK | MB_ICONINFORMATION);
		return 0;
	}
	int *viz=(int *)malloc(6*sizeof(int));
	for(int i=0;i<6;i++)
		viz[i]=0,adiac[i][i]=0;
	adg_coada(n);
  
 	while(1)
	{
	   int x=extrag_coada();
	   if(x==-1)
		   break;
	   if(!viz[x])
	      t++;
	   viz[x]=1;
	   for(int j=0;j<6;j++)
		   if(adiac[x][j]!=0)
			   if(viz[j]==0)
				   adg_coada(j);
	}
	
 if(t==6)
  return 1;
 else
	 return 0;
}
int verif_inceput_arb_cost_min()
{
	int j=0;
	for(int i=0;i<nrm;i++)
		if(strcmp(v[i].s,""))
			j++;
	if(j==5)
		return 1;
	else
		return 0;
}
void reset()
{
	for(int i=0;i<12;i++)
		strcpy(elim[i].s,"-1");
}